WcnmdUtils = {
	isEnd : function(result) {
		if (result.substring(0, 1) == "#" && result.length < 10) {
			return true;
		} else {
			return false;
		}
	},
}

function Wcnmd() {
	var _this = this;

	this.connect = function(data, callback) {

		$.ajax({
			type : 'POST',
			url : "/wcnmd/connect",
			data : JSON.stringify(data),
			contentType : "application/json; charset=utf-8",
			dataType : "json",
			success : function(result) {
				callback(result);
			}
		});
	};



	this.execCmd = function(cmd, token, callback) {
		var obj = new Object();
		obj.cmd = cmd;
		obj.connectToken = token;
		$.ajax({
			type : 'POST',
			url : "/wcnmd/execCmd",
			data : JSON.stringify(obj),
			contentType : "application/json; charset=utf-8",
			dataType : "json",
			success : function(result) {
				callback(result);
			}
		});
	};


	this.disconnect = function(token,callback) {
		var obj = new Object();
		obj.connectToken = token;

		$.ajax({
			type : 'POST',
			url : "/wcnmd/disconnect",
			data : JSON.stringify(obj),
			contentType : "application/json; charset=utf-8",
			dataType : "json",
			success : function(result) {
				callback(result);
			}
		});
	};


}